<?php
$stratdates = date('Y-m-d');
$addTwosdaysIndate = date("Y-m-d", strtotime("$stratdates +2 day"));
$indexes = $index + 1;
if ($data['start_date'] <= $addTwosdaysIndate) {
    if (isset($data['courses_id']) && !empty($data['courses_id'])) {
        $courseName = getClassCoursCharLimit($data['course_titile']);
        $userDetails = getUserTypeByClassCourse('Courses', $data['courses_id']);
        $imagePath = getImagePathByClassCourse('Courses', $data['courses_id']);
        $url = $this->createAbsoluteUrl('/courses-'.$data['courses_id'].'/'.$data['course_seo_title']);
        $session = Courses::countCousrseBatchDateSession($data['courses_id']);
        $imageName = (ClassImage::getCoursesPrimaryImage($data['courses_id']) != '') ? getRequestbaseUrl() . getuploadFolderDir(). SkillConfig::getClassCourseImagePath($imagePath) . '207X145/' . ClassImage::getCoursesPrimaryImage($data['courses_id']) : getWorkNoshopimage(SkillConfig::skill_home_category_no_image);
        $booknow = ($data['course_type_id'] == COURSE_CLASS_TYPE) ? 'Make Query' : 'Book Now';
        $priceRange = CourseBatche::findMinMaxPriceByClassbatchforCategoryPage($data['courses_id']);
        $trainerResponse = MakeQuery::trainerResponseRate($data['front-user'], $data['backend-user']);
        $coursePrice = 'COURSE PRICE';
        $levelType = classCourseLevelType('Courses', $data['courses_id']);
        $cssLevel = LevelCssClassName('Courses', $data['courses_id']);       
        $locationName = ClassVenue::getLocationNameBycourseVenueId($data['course_venue_id']);
        $batchStartDate = date('d  M', strtotime($data['start_date'])) . ' (' . date('D', strtotime($data['start_date'])) . ') ' . '  -  ' . date('d  M', strtotime($data['end_date'])) . ' (' . date('D', strtotime($data['start_date'])) . ')';
    } else {
        $cssLevel = LevelCssClassName('Classes', $data['classes_id']);
        $courseName = getClassCoursCharLimit($data['class_titile']);
        $userDetails = getUserTypeByClassCourse('Classes', $data['classes_id']);
        $imagePath = getImagePathByClassCourse('Classes', $data['classes_id']);
        $url = $this->createAbsoluteUrl('/workshop-'.$data['classes_id'].'/'.$data['class_seo_title']);
        $session = CLASS_NO_SESSION;
        $imageName = (ClassImage::getPrimaryImage($data['classes_id']) != '') ? getRequestbaseUrl() . getuploadFolderDir() . SkillConfig::getClassCourseImagePath($imagePath) . '207X145/' . ClassImage::getPrimaryImage($data['classes_id']) : getWorkNoshopimage(SkillConfig::skill_home_category_no_image);
        $booknow = ($data['class_type_id'] == CURATED_CLASS_TYPE) ? 'Book Now' : 'Make a Query ';
        $priceRange = ClassBatch::findMinMaxPriceByClassbatchforCategoryPage($data['classes_id']);
        $trainerResponse = MakeQuery::trainerResponseRate($data['front-user'], $data['backend-user']);
        $levelType = classCourseLevelType('Classes', $data['classes_id']);      
        $locationName = ClassVenue::getLocationNameByVenueId($data['class_venue_id']);
        $batchStartDate = date('d  M', strtotime($data['start_date'])) . ' (' . date('D', strtotime($data['start_date'])) . ')';
    }

    
    if (($indexes % 3) == 0) {

        echo '<div class="row">';
    };
    ?>
    <div class="col-lg-4 col-md-4 col-sm-6">
        <a href="<?php echo $url; ?>">
            <div class="thumbnail">
                <?php echo '<img src="' . $imageName . '"  alt="' . $courseName . '">'; ?>
                <div class="caption">
                    <h4><?php echo $courseName; ?></h4>
                    <p class="trainer-name">By:<?php echo substr($userDetails->first_name . '  ' . $userDetails->last_name, 0, 20); ?></p>
                    <div class="workinfo">
                        <span><?php echo $locationName; ?> <span class="rupee"><?php echo $priceRange; ?></span></span>
                        <span><?php echo $batchStartDate; ?></span>
                    </div>
                    <div class="session">
                        <ul class="list-unstyled sessioninfo">
                            <li>
                                <span>session</span>
                                <span><?php echo $session; ?></span>
                            </li>
                            <li>
                                <span class="<?php echo $cssLevel; ?>"></span>
                                <span>Level</span>
                                <span><?php echo $levelType; ?></span>
                            </li>
                            <li>
                                <span>Response Rate</span>
                                <span><?php echo (!empty($trainerResponse) ? $trainerResponse . '%' : TRAINER_RESPONSE_RATE); ?></span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </a>
    </div>

    <?php
    if (($indexes % 3) == 0) {
        echo'<div class="gap"></div></div>';
    };
    ?>

    

<?php }